class Mini { 
  //上传文件
  static upload(imageList) {
    var that = this;
    // var grade;
    // wx.getStorage({
    //   key: 'grade',
    //   success: function(res){
    //     grade = res.data
    //     console.log(grade)
    //   }
    // })
    // console.log(imageList)
    return Promise.all(imageList.map((image, index) => {
      return new Promise((resolve, reject) => {
        console.log(image)
        wx.uploadFile({
          url: 'https://buxueyeba.home.mogeek.cn/a/u/upload',   //这里的地址填写你的后台上传地址
          filePath: image,    
          name: 'file',     //上传文件的name
          header:{
            'userToken':'xuexi.xuegepi.lol' 
          },          
          formData: {
            // 'grade':grade
          },                 
          success: function(res) {
            resolve(res.data);
          },
          fail: function(err) {
            reject(new Error('failed to upload file'));
          }
        });
      });
    }));
  }
};
module.exports = Mini;